<template>
  <div class="page">
    <el-breadcrumb class="breadcrumb" separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item>品牌馆</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="cate-list">
      <div class="cate-item" v-for="(cate, ci) in brandList" :key="ci">
        <h4 class="cate-tit">{{cate.categoryName}}</h4>
        <ul class="brand-list">
          <li class="brand-item" v-for="(brand, bi) in cate.brands" :key="bi">
            <router-link class="brand-box" :to="'/store/storeInfo?storeId=' + brand.storeId">
              <div class="logo">
                <img class="brand-img" :src="brand.brandImg" width="160" height="160">
              </div>
              <p class="name">{{brand.brandName}}</p>
            </router-link>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      brandList: []
    }
  },
  mounted () {
    this.getData()
  },
  methods: {
    getData () {
      this.$http.post(this.$api + '/pc/home/getProductBrandDetais', {}).then(res => {
        if (res.responseCode === '0000') {
          this.brandList = res.data
        } else {
          this.$message.error({
            duration: this.$store.state.duration,
            message: res.responseMsg
          })
        }
      }).catch(err => {
        console.error(err)
      })
    }
  }
}
</script>

<style lang="scss">
.breadcrumb {
  margin: 20px 0;
}
.cate-list {
  .cate-item {
    overflow: hidden;
    .cate-tit {
      margin: 30px auto;
      width: 180px;
      height: 44px;
      line-height: 44px;
      font-size: 20px;
      color: #333;
      text-align: center;
      background: url(../../assets/images/cate-tit-bg.png) center no-repeat;
    }
    .brand-list {
      margin-left: -10px;
      margin-right: -10px;
      &::before,
      &::after {
        content: '';
        clear: both;
        display: table;
      }
      .brand-item {
        float: left;
        margin-bottom: 30px;
        padding: 0 10px;
        width: 20%;
        .brand-box {
          display: block;
          width: 100%;
          text-decoration: none;
          background: #ffffff;
          border: solid 1px #f7f7f7;
          transition: all ease-in-out 0.2s;
          &:hover {
            transform: translate(0, -2px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, .1);
          }
          .logo {
            width: 100%;
            .brand-img {
              margin: 31px auto;
            }
          }
          .name {
            height: 50px;
            line-height: 50px;
            text-align: center;
            font-size: 20px;
            color: #333;
            border-top: solid 1px #f7f7f7;
          }
        }
      }
    }
  }
}
</style>
